package dao

import (
	"ZK306/common/inits"
	"ZK306/common/models"
)

func GetUserInfo(mobile string) (user *models.User, err error) {
	if err = inits.DB.Raw("select * from users where mobile=? limit 1", mobile).Scan(&user).Error; err != nil {
		return nil, err
	}
	return user, nil
}

func UserCreate(mobile string) bool {
	user := models.User{
		Mobile: mobile,
	}
	if err := inits.DB.Create(&user).Error; err != nil {
		return false
	}
	return true
}
